<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 邮件验证码
 */
class EmailSms extends Model
{
    protected $table = "email_sms";

    protected $fillable = [
        'id',
        'email', //email
        'code', //验证码
        'send_time', //发送时间
        'expire_time', //过期时间
        'type', //类型
    ];

    const TYPE_ONE = 1;
    const TYPE_TWO = 2;
    const TYPE_THREE = 3;
    const TYPE_FOUR = 4;
    const TYPE_FIVE =5;
    public static $TYPE = [
        self::TYPE_ONE => '登录',
        self::TYPE_TWO => '注册',
        self::TYPE_THREE => '忘记密码',
        self::TYPE_FOUR => '修改密码',
        self::TYPE_FIVE => '商家入驻',
    ];

    public function user()
    {
        return $this->hasOne('App\\Models\\User', 'email', 'email');
    }
}
